#pragma once
#include "DXAMLCommon.h"
#include "IPALCriticalSection.h"
#include "IPALWaitable.h"
#include "IPALEvent.h"
#include "IPALSemaphore.h"
#include "IPALQueue.h"
#include "IPALMutex.h"
#include "IPALMemory.h"
class IPALThreadingServices
{
public:
	virtual XINT32       InterlockedCompareExchange( XINT32 *pTarget, XINT32 Exchange, XINT32 Comperand) = 0;
	virtual void *       PALInterlockedCompareExchangePointer( void **ppTarget, void *pExchange, void *pComperand) = 0;
	virtual void *       PALInterlockedExchangePointer( void **ppTarget, void *pExchange) = 0;
	virtual XINT32       InterlockedDecrement( XINT32 *pnTarget) = 0;
	virtual XINT32       InterlockedExchange( XINT32 *pnTarget, XINT32 nValue) = 0;
	virtual XINT32       InterlockedExchangeAdd( XINT32 *pnTarget, XINT32 nValue) = 0;
	virtual XINT32       InterlockedIncrement( XINT32 *pnTarget) = 0;
	virtual HRESULT      CriticalSectionCreate( IPALCriticalSection **ppCritical) = 0;
	virtual HRESULT      ThreadCreate( IPALWaitable **ppThread, XINT32 (__stdcall *pfn)(char *), XUINT32 cData, char *pData) = 0;
	virtual HRESULT      EventCreate( IPALEvent **ppEvent, XINT32 bSignaled, XINT32 bManual) = 0;
	virtual HRESULT      SemaphoreCreate( IPALSemaphore **ppSemaphore, XUINT32 cMaxCount, XUINT32 cInitialCount) = 0;
	virtual HRESULT      QueueCreate( IPALQueue **ppQueue, XUINT32 cMaxLength) = 0;
	virtual HRESULT      SharedMemoryCreate( IPALMemory **ppSharedMemory, PAL_IPCInitMode initMode, XUINT32 bLowIntegrity, XUINT32 ulSize, CXString *pstrName) = 0;
	virtual HRESULT      SharedMemoryDestroy(CXString * pstrName) = 0;
	virtual HRESULT      NamedMutexCreate( IPALMutex **ppNamedMutex, PAL_IPCInitMode initMode, XUINT32 bLowIntegrity, XUINT32 bInitialOwner, CXString *pstrName) = 0;
	virtual HRESULT      NamedMutexDestroy(CXString * pstrName) = 0;
	virtual HRESULT      NamedEventCreate( IPALEvent **ppEvent, PAL_IPCInitMode initMode, XUINT32 bLowIntegrity, XUINT32 bInitialState, CXString *pstrName) = 0;
	virtual HRESULT      NamedEventDestroy(CXString * pstrName) = 0;
	virtual XUINT32      WaitForObjects( XUINT32 cWaitable, IPALWaitable **ppWaitable, XINT32 bAll, XUINT32 nTimeout) = 0;
	virtual HRESULT      PALSleep( XUINT32 dwMilliseconds) = 0;
	virtual XINT32       ThreadGetPriority( IPALWaitable *pThread) = 0;
	virtual HRESULT      ThreadSetPriority( IPALWaitable *pThread, XINT32 nPriority) = 0;
	virtual XINT32       ProcessGetPriority() = 0;
	virtual HRESULT      ProcessSetPriority( XINT32 nPriority) = 0;
};